<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- /fasttmp/mkdist-qt-4.3.5-1211793125/qtopia-core-opensource-src-4.3.5/src/gui/image/qimageiohandler.cpp -->
<head>
  <title>Qt 4.3: QImageIOPlugin Class Reference</title>
  <link href="classic.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="left" valign="top" width="32"><a href="http://www.trolltech.com/products/qt"><img src="images/qt-logo.png" align="left" width="32" height="32" border="0" /></a></td>
<td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&nbsp;&middot; <a href="classes.html"><font color="#004faf">All&nbsp;Classes</font></a>&nbsp;&middot; <a href="mainclasses.html"><font color="#004faf">Main&nbsp;Classes</font></a>&nbsp;&middot; <a href="groups.html"><font color="#004faf">Grouped&nbsp;Classes</font></a>&nbsp;&middot; <a href="modules.html"><font color="#004faf">Modules</font></a>&nbsp;&middot; <a href="functions.html"><font color="#004faf">Functions</font></a></td>
<td align="right" valign="top" width="230"><a href="http://www.trolltech.com"><img src="images/trolltech-logo.png" align="right" width="203" height="32" border="0" /></a></td></tr></table><h1 align="center">QImageIOPlugin Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1>
<p>The QImageIOPlugin class defines an interface for writing an image format plugin. <a href="#details">More...</a></p>
<pre> #include &lt;QImageIOPlugin&gt;</pre><p>Inherits <a href="qobject.html">QObject</a>.</p>
<ul>
<li><a href="qimageioplugin-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="public-types"></a>
<h3>Public Types</h3>
<ul>
<li><div class="fn"/>flags <b><a href="qimageioplugin.html#Capability-enum">Capabilities</a></b></li>
<li><div class="fn"/>enum <b><a href="qimageioplugin.html#Capability-enum">Capability</a></b> { CanRead, CanWrite, CanReadIncremental }</li>
</ul>
<a name="public-functions"></a>
<h3>Public Functions</h3>
<ul>
<li><div class="fn"/><b><a href="qimageioplugin.html#QImageIOPlugin">QImageIOPlugin</a></b> ( QObject * <i>parent</i> = 0 )</li>
<li><div class="fn"/>virtual <b><a href="qimageioplugin.html#dtor.QImageIOPlugin">~QImageIOPlugin</a></b> ()</li>
<li><div class="fn"/>virtual Capabilities <b><a href="qimageioplugin.html#capabilities">capabilities</a></b> ( QIODevice * <i>device</i>, const QByteArray &amp; <i>format</i> ) const = 0</li>
<li><div class="fn"/>virtual QImageIOHandler * <b><a href="qimageioplugin.html#create">create</a></b> ( QIODevice * <i>device</i>, const QByteArray &amp; <i>format</i> = QByteArray() ) const = 0</li>
<li><div class="fn"/>virtual QStringList <b><a href="qimageioplugin.html#keys">keys</a></b> () const = 0</li>
</ul>
<ul>
<li><div class="fn"/>29 public functions inherited from <a href="qobject.html#public-functions">QObject</a></li>
</ul>
<h3>Additional Inherited Members</h3>
<ul>
<li><div class="fn"/>1 property inherited from <a href="qobject.html#properties">QObject</a></li>
<li><div class="fn"/>1 public slot inherited from <a href="qobject.html#public-slots">QObject</a></li>
<li><div class="fn"/>1 signal inherited from <a href="qobject.html#signals">QObject</a></li>
<li><div class="fn"/>5 static public members inherited from <a href="qobject.html#static-public-members">QObject</a></li>
<li><div class="fn"/>7 protected functions inherited from <a href="qobject.html#protected-functions">QObject</a></li>
</ul>
<a name="details"></a>
<hr />
<h2>Detailed Description</h2>
<p>The QImageIOPlugin class defines an interface for writing an image format plugin.</p>
<p>QImageIOPlugin is a factory for creating <a href="qimageiohandler.html">QImageIOHandler</a> objects, which are used internally by <a href="qimagereader.html">QImageReader</a> and <a href="qimagewriter.html">QImageWriter</a> to add support for different image formats to Qt.</p>
<p>Writing an image I/O plugin is achieved by subclassing this base class, reimplementing the pure virtual functions <a href="qimageioplugin.html#capabilities">capabilities</a>(), <a href="qimageioplugin.html#create">create</a>(), and <a href="qimageioplugin.html#keys">keys</a>(), and exporting the class with the <a href="qtplugin.html#Q_EXPORT_PLUGIN2">Q_EXPORT_PLUGIN2</a>() macro. See <a href="plugins-howto.html">How to Create Qt Plugins</a> for details.</p>
<p>An image format plugin can support three capabilities: reading (<a href="qimageioplugin.html#Capability-enum">CanRead</a>), writing (<a href="qimageioplugin.html#Capability-enum">CanWrite</a>) and <i>incremental</i> reading (<a href="qimageioplugin.html#Capability-enum">CanReadIncremental</a>). Reimplement <a href="qimageioplugin.html#capabilities">capabilities</a>() in you subclass to expose the capabilities of your image format.</p>
<p><a href="qimageioplugin.html#create">create</a>() should create an instance of your <a href="qimageiohandler.html">QImageIOHandler</a> subclass, with the provided device and format properly set, and return this handler. You must also reimplement <a href="qimageioplugin.html#keys">keys</a>() so that Qt knows which image formats your plugin supports.</p>
<p>Different plugins can support different capabilities. For example, you may have one plugin that supports reading the GIF format, and another that supports writing. Qt will select the correct plugin for the job, depending on the return value of <a href="qimageioplugin.html#capabilities">capabilities</a>(). If several plugins support the same capability, Qt will select one arbitrarily.</p>
<p>See also <a href="qimageiohandler.html">QImageIOHandler</a> and <a href="plugins-howto.html">How to Create Qt Plugins</a>.</p>
<hr />
<h2>Member Type Documentation</h2>
<h3 class="flags"><a name="Capability-enum"></a>enum QImageIOPlugin::Capability<br />flags QImageIOPlugin::Capabilities</h3>
<p>This enum describes the capabilities of a <a href="qimageioplugin.html">QImageIOPlugin</a>.</p>
<p><table border="1" cellpadding="2" cellspacing="1" width="100%">
<tr><th width="25%">Constant</th><th width="15%">Value</th><th width="60%">Description</th></tr>
<tr><td valign="top"><tt>QImageIOPlugin::CanRead</tt></td><td align="center" valign="top"><tt>0x1</tt></td><td valign="top">The plugin can read images.</td></tr>
<tr><td valign="top"><tt>QImageIOPlugin::CanWrite</tt></td><td align="center" valign="top"><tt>0x2</tt></td><td valign="top">The plugin can write images.</td></tr>
<tr><td valign="top"><tt>QImageIOPlugin::CanReadIncremental</tt></td><td align="center" valign="top"><tt>0x4</tt></td><td valign="top">The plugin can read images incrementally.</td></tr>
</table></p>
<p>The Capabilities type is a typedef for <a href="qflags.html">QFlags</a>&lt;Capability&gt;. It stores an OR combination of Capability values.</p>
<hr />
<h2>Member Function Documentation</h2>
<h3 class="fn"><a name="QImageIOPlugin"></a>QImageIOPlugin::QImageIOPlugin ( <a href="qobject.html">QObject</a> * <i>parent</i> = 0 )</h3>
<p>Constructs an image plugin with the given <i>parent</i>. This is invoked automatically by the <a href="qtplugin.html#Q_EXPORT_PLUGIN2">Q_EXPORT_PLUGIN2</a>() macro.</p>
<h3 class="fn"><a name="dtor.QImageIOPlugin"></a>QImageIOPlugin::~QImageIOPlugin ()&nbsp;&nbsp;<tt> [virtual]</tt></h3>
<p>Destroys the picture format plugin.</p>
<p>You never have to call this explicitly. Qt destroys a plugin automatically when it is no longer used.</p>
<h3 class="fn"><a name="capabilities"></a><a href="qimageioplugin.html#Capability-enum">Capabilities</a> QImageIOPlugin::capabilities ( <a href="qiodevice.html">QIODevice</a> * <i>device</i>, const <a href="qbytearray.html">QByteArray</a> &amp; <i>format</i> ) const&nbsp;&nbsp;<tt> [pure virtual]</tt></h3>
<p>Returns the capabilities on the plugin, based on the data in <i>device</i> and the format <i>format</i>. For example, if the <a href="qimageiohandler.html">QImageIOHandler</a> supports the BMP format, and the data in the device starts with the characters &quot;BM&quot;, this function should return <a href="qimageioplugin.html#Capability-enum">CanRead</a>. If <i>format</i> is &quot;bmp&quot; and the handler supports both reading and writing, this function should return <a href="qimageioplugin.html#Capability-enum">CanRead</a> | <a href="qimageioplugin.html#Capability-enum">CanWrite</a>.</p>
<h3 class="fn"><a name="create"></a><a href="qimageiohandler.html">QImageIOHandler</a> * QImageIOPlugin::create ( <a href="qiodevice.html">QIODevice</a> * <i>device</i>, const <a href="qbytearray.html">QByteArray</a> &amp; <i>format</i> = QByteArray() ) const&nbsp;&nbsp;<tt> [pure virtual]</tt></h3>
<p>Creates and returns a <a href="qimageiohandler.html">QImageIOHandler</a> subclass, with <i>device</i> and <i>format</i> set. The <i>format</i> must come from the list returned by <a href="qimageioplugin.html#keys">keys</a>(). Format names are case sensitive.</p>
<p>See also <a href="qimageioplugin.html#keys">keys</a>().</p>
<h3 class="fn"><a name="keys"></a><a href="qstringlist.html">QStringList</a> QImageIOPlugin::keys () const&nbsp;&nbsp;<tt> [pure virtual]</tt></h3>
<p>Returns the list of image keys this plugin supports.</p>
<p>These keys are usually the names of the image formats that are implemented in the plugin (e.g&#x2e;, &quot;jpg&quot; or &quot;gif&quot;).</p>
<p>See also <a href="qimageioplugin.html#capabilities">capabilities</a>().</p>
<p /><address><hr /><div align="center">
<table width="100%" cellspacing="0" border="0"><tr class="address">
<td width="30%">Copyright &copy; 2008 <a href="trolltech.html">Trolltech</a></td>
<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
<td width="30%" align="right"><div align="right">Qt 4.3.5</div></td>
</tr></table></div></address></body>
</html>
